package init

import (
	"getaway/basic/config"
	"log"

	"github.com/go-redis/redis/v8"
)

func RedisInit() {
	config.Rdb = redis.NewClient(&redis.Options{
		Addr:     "124.222.68.180" + ":" + "6379",
		Password: "a18dee684cb5c29dfc8762353b1db8cf", // no password set
		DB:       0,                                  // use default DB
	})

	err := config.Rdb.Set(config.Ctx, "key", "value", 0).Err()
	if err != nil {
		panic(err)
	}
	log.Println("redis init success")
}
